<template>
  <div id="app">
    <Header v-if="$route.meta.showPublicHeader"></Header>
    <router-view class="main"></router-view>
    <Footer v-if="$route.meta.showPublicFooter"></Footer>
  </div>
</template>

<script>
import Footer from "@/components/publicFooter";
import Header from "@/components/publicHeader";
export default {
  name: "App",
  data() {
    return {};
  },
  created() {
    const token = localStorage.getItem("token");
    this.$store.commit("changetoken", token);

    // 地址
    const address = JSON.parse(localStorage.getItem("address")) || {};
    this.$store.commit("address/changereceiver", address.receiver);
    this.$store.commit("address/changeregions", address.regions);
    this.$store.commit("address/changeaddress", address.address);
  },
  components: {
    Footer,
    Header,
  },
};
</script>

<style>
.main {
  margin-top: 45px;
}
</style>
